package com.laguille.games.monopoly.server;

import java.util.List;

import com.laguille.games.monopoly.commons.board.Board;
import com.laguille.games.monopoly.commons.player.Player;
import com.laguille.games.monopoly.commons.property.Property;

/**
 * A game context keeps track of the current game status, i.e:
 * <UL><LI>how many players are still in the game</LI> 
 * <LI>who is the current player</LI>
 * <LI>which properties players own</LI>
 * <LI>the latest board status</LI></UL>
 *
 * The class also manages the change of current player, and the status of the game (finished or not).
 */
public interface GameContext {

	/**
	 * Returns a reference to the board.
	 * @return the board
	 */
	public Board getBoard();
	

	/** 
	 * Register a new player in the game.
	 * @param player	the player to register
	 */
	public void registerPlayer(Player player);
	
	/**
	 * Returns a List of active players.
	 * @return the active players.
	 */
	public List<Player> getPlayers();

	/**
	 * Returns a List of all the players in the game (active or not). 
	 * @return the players.
	 */
	public List<Player> getAllPlayers();
	
	/**
	 * Removes a player from the game.
	 * @param player the player to remove.
	 */
	public void removePlayerFromGame(Player player);
	
	/**
	 * Returns the current player.
	 * @return the current player
	 */
	public Player getCurrentPlayer();

	/**
	 * Replaces the current player with the next player.
	 */
	public void nextPlayer();

	/**
	 * Returns true if the game is over, false otherwise.
	 * The game is over when there is only one active players left in the game.
	 * @return true if game over, false otherwise.
	 */
	public boolean isGameOver();
	
	/**
	 * Returns the winner of the game or null if the game is not finished yet.
	 * @return the winner of the game if there is one, null otherwise.
	 */
	public Player getWinner();
	
	/**
	 * Returns the owner of the <code>property</code>, or null if vacant.
	 * @param property the property.
	 * @return the owner or null if none.
	 */
	public Player getOwner(Property property);
	
	/**
	 * Returns the player position on the board.
	 * @param player the player to locate.
	 * @return the player position.
	 */
//	public Space getPlayerPosition(Player player);
	
}
